package com.example.clothingmanager.dao;

import com.example.clothingmanager.bean.Clothes;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * @author Huangyt
 * @version 1.0
 * @date 2020/5/7 16:45
 */
public interface ClothesDao extends JpaRepository<Clothes, String> {

    @Query(value = "select * from tb_clothes where cname like CONCAT('%', :keyword, '%')", nativeQuery = true, countQuery = "select count(1) from tb_clothes")
    public Page<Clothes> findByKeyword(String keyword, Pageable pageable);
}
